home *** CD-ROM | disk | FTP | other *** search
- #include <GXGraphics.h>
- #include "AccurateShapes.h"
-
- /************************
-
- Wrapper for GXGetShapeLength
- which returns a fixed point value.
-
- ************************/
- Fixed ClGetFixedShapeLength(gxShape theShape);
- Fixed ClGetFixedShapeLength(gxShape theShape)
- {
- wide wLength;
- Fixed pathLength;
-
- GXGetShapeLength(theShape, 0, &wLength);
- pathLength = (Fixed)wLength.lo;
-
- return(pathLength);
-
- }//ClGetFixedShapeLength
-
-
- gxShape MakeThePath(void);
- gxShape MakeThePath(void)
- {
- static gxCurve curveGeometry = {ff(50), ff(325), ff(175), ff(150), ff(300), ff(325) };
- static gxCurve curveGeometry2 = {ff(300), ff(325), ff(425), ff(500), ff(550), ff(325) };
- gxShape nicePath;
- gxShape curve2;
-
- nicePath = GXNewCurve(&curveGeometry);
- GXSetShapeType(nicePath, gxPathType);
- curve2= GXNewCurve(&curveGeometry2);
- GXSetShapeParts(nicePath, 0, 0, curve2, gxBreakNeitherEdit);
- GXDisposeShape(curve2);
-
- GXSetShapeFill(nicePath, gxFrameFill);
-
- GXMoveShape(nicePath, ff(0), ff(-120));
-
- return(nicePath);
- }
-
-
- gxShape MakeDashShape(gxShape thePath);
- gxShape MakeDashShape(gxShape thePath)
- {
- char polydata[100];
- gxPolygons *thePoly = (gxPolygons*)polydata;
- long *aLong;
- gxPoint *aPoint;
- char *p = polydata;
-
- aLong = (long*)p;
- *aLong = 3; // number of countours;
- p += sizeof(aLong);
- aLong = (long*)p;
- *aLong = 2; // points in first contour;
- p += sizeof(long);
- aPoint = (gxPoint*)p;
- aPoint->x = ff(50);
- aPoint->y = ff(0);
- p += sizeof(gxPoint);
-
- aPoint = (gxPoint*)p;
- aPoint->x = ff(100);
- aPoint->y = ff(0);
- p += sizeof(gxPoint);
-
- aLong = (long*)p;
- *aLong = 2; // points in second countour;
- p += sizeof(long);
- aPoint = (gxPoint*)p;
- aPoint->x = ff(150);
- aPoint->y = ff(0);
- p += sizeof(gxPoint);
-
- aPoint = (gxPoint*)p;
- aPoint->x = ff(250);
- aPoint->y = ff(0);
- p += sizeof(gxPoint);
-
- aLong = (long*)p;
- *aLong = 2; // points in second countour;
- p += sizeof(long);
- aPoint = (gxPoint*)p;
- aPoint->x = ff(300);
- aPoint->y = ff(0);
- p += sizeof(gxPoint);
-
- aPoint = (gxPoint*)p;
- aPoint->x = ClGetFixedShapeLength(thePath);
- aPoint->y = ff(0);
- p += sizeof(gxPoint);
-
-
- return(GXNewPolygons(thePoly));
- }
-
- main() {
-
- gxShape thePath = MakeThePath();
- gxDashRecord aDash;
- gxColor aColor;
- gxShape dashShape;
-
-
- GXDrawShape(thePath);
-
- dashShape = MakeDashShape(thePath);
- aDash.dash = dashShape;
- aDash.attributes = gxBendDash;
- aDash.phase = 0;
- aDash.advance = 0;
- GXSetShapeDash(thePath, &aDash);
- GXDisposeShape(dashShape);
-
- AccuratePrimitiveShape(thePath);
- GXSetShapeDash(thePath, nil);
-
- aColor.space = gxRGBSpace;
- aColor.profile = nil;
- aColor.element.rgb.red = 0;
- aColor.element.rgb.green = 0xFFFF;
- aColor.element.rgb.blue = 0;
- GXSetShapeColor(thePath, &aColor);
- GXDrawShape(thePath);
- }